// var userId = 'MS4wLjABAAAAFNWM787uCeY46Jcv9YupIZ4N5R8HsO0mx3eiqyYnuws_LErG1PD2SQodGxwiaLNe' // 密桃
// var userId = 'MS4wLjABAAAA9-gJXfg__ZYHZP7OuoTEgfWpL2RkDIFWjcH7TG2BRWNYD2S743r-dudCAgfsZXkk' // 斐秀
// var userId = 'MS4wLjABAAAAb5LGcn6IxL7Bc-4r1WvioePpIiNTIZlDRdHyg8Ubbl-UGU6UT91qdIRpW4MHrej0' // 测试

function getLiveLink() {
  const dom = document.querySelector('div[data-e2e=user-detail] .semi-avatar-wrapper')
  if (dom) {
    const a = document.querySelector('div[data-e2e=user-detail] a:has(.semi-avatar-wrapper)')
    return a.href
  } else {
    console.log('未开播')
  }
}

async function main() {
  dyTimers.hb && clearInterval(dyTimers.hb)
  dyTimers.hb = setInterval(() => {
    const link = getLiveLink()
    if (link) {
      location.href = link
    }
  }, 1e3)
}
main()
